class ImagesController < ApplicationController
  def serve
    sample = Sample.find(params[:sample_id])

    image = MiniMagick::Image.open(sample.image_path)
    image.format 'jpg'
    image.resize '341x256'
    file = Tempfile.new(sample.uuid)
    image.write file.path

    send_file(file.path,
      :disposition => 'inline',
      :type => 'image/bmp',
      :x_sendfile => true )
  end
end
